package IO;

import java.io.CharArrayReader;
import java.io.IOException;

public class CharArrayReaderTest {
    public static void main(String[] args) throws IOException {
        char[] buff = new char[]{'你', '好', ',', 'w', 'o', 'r', 'l', 'd', '!'};
        CharArrayReader reader = new CharArrayReader(buff);
        int data;
        //read()方法每次读一个字符,读到结尾返回-1
        while ((data = reader.read()) != -1) {
            System.out.print((char) data);
        }
        reader.close();
    }
}
